<?php
/**
 * 实现的方法
 * TransHistory
 */
require 'config.php';
require 'Lib_btc.php';
echo '<pre>';
$btcAccounts = getBtcAccounts();
if( !empty($btcAccounts) )
	foreach( $btcAccounts AS $i=>$account )
{
	$param = Array('key'=>$account['key'], 'srt'=>$account['srt'] );

// 	echo sprintf("%5.8f",$account['btc']).'<br/>';
// 	echo sprintf("%5.8f",$account['nvc']).'<br/>';
// 	echo sprintf("%5.8f",$account['usd']);

// 	continue;
	$result = btce_query("getInfo", $param);
	var_dump($result);
	if( !empty($result) && $result['success'] == BTC_API_SUCCESS )
	{
		$row = $result['return'];
		$row['right_info'] = $row['rights']['info'];
		$row['right_trade'] = $row['rights']['trade'];
		$row['right_withdraw'] = $row['rights']['withdraw'];
		$row['date_update'] = @date('Y-m-d H:i:s',$row['server_time']);
		$row['user'] = $account['user'];
		$row['user_id'] = $account['id'];
		unset( $row['rights']);
		unset( $row['server_time']);
		updateBtcAccount($row);
	}
}
echo "<script>
<!--
setTimeout(function(){location.replace(location.href);},30000);
//-->
</script>";
?>
